set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
cmake_minimum_required(VERSION 3.10.0)
project(SDL3VulkanDemo VERSION 0.1.0 LANGUAGES C CXX)


find_package(SDL3 CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)

add_executable(SDL3VulkanDemo src/main.cpp)

target_link_libraries(SDL3VulkanDemo PRIVATE SDL3::SDL3 spdlog::spdlog_header_only)

#link vulkan
if(IOS)
    set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
    find_library(UIKIT_LIB UiKit)
    find_library(COREMEDIA_LIB CoreMedia)
    find_library(METAL_LIB Metal)
    find_package(Vulkan REQUIRED COMPONENTS MoltenVK)
    set_target_properties(SDL3VulkanDemo PROPERTIES
        MACOSX_BUNDLE TRUE
        MACOSX_BUNDLE_BUNDLE_NAME "SDL3VulkanDemo"
        MACOSX_BUNDLE_BUNDLE_VERSION "1.0"
        MACOSX_BUNDLE_SHORT_VERSION_STRING "1.0"
        MACOSX_BUNDLE_GUI_IDENTIFIER "com.test.SDL3VulkanDemo" 
    )
    #Disable signing
     set_target_properties(SDL3VulkanDemo PROPERTIES
        XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO"
        XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO"
    )
    target_link_libraries(SDL3VulkanDemo PRIVATE
        ${UIKIT_LIB}
        ${METAL_LIB}
        ${QUARTZCORE_LIB}
    )
    target_link_libraries(SDL3VulkanDemo PRIVATE Vulkan::Headers)
else()
    find_package(Vulkan REQUIRED COMPONENTS volk)
    target_link_libraries(SDL3VulkanDemo PRIVATE Vulkan::Vulkan Vulkan::volk)
endif()
message(STATUS "The path to the Vulkan library: ${Vulkan_LIBRARY}")